﻿using MLSMooc.Helper;
using MLSMooc.Session;
using MLSMooc.Session.Implement;
using MLSMooc.Session.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MLSMooc.Controllers
{
    public class SessionController : Controller
    {
        [HttpGet]
        public string GetSessionAsync()
        {
            SessionUser userSession = SessionUserService.GetInstance().DeSerializeDecrypt(SessionBaseOpt.GetSessionState<string>(ConstantHelper.USER, string.Empty));
            return SerializeHelper.SerializeJson(userSession);
        }

        [HttpGet]
        public void SignOut()
        {
            SessionBaseOpt.ClearSession(ConstantHelper.USER);
        }
    }
}